import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop034_余额调整"

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"客户管理","管理客户")
money=firefox.find_element_by_xpath("//td[text()='kunkun']/following-sibling::td[5]").text
print(type(money))
firefox.find_element_by_xpath("//td[text()='kunkun']/following-sibling::td[7]/a[2]").click()
time.sleep(3)
firefox.find_element_by_id("money_change_num").send_keys("10000")
firefox.find_element_by_id("money_pay_info").send_keys("买手机用")
new_money=float(money)+10000
firefox.find_element_by_xpath("//button[text()='提交充值']").click()
time.sleep(3)

firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text("用户中心").click()
firefox.find_element_by_link_text("账户余额").click()
s=firefox.find_element_by_xpath("//font[@color='#dd4b39']").text
print(s)
l="￥"
r=" 元"
print(reGetString(s,l,r))
if str(new_money)==reGetString(s,l,r):
    writeLog("%s 测试通过" % testCase)

else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
